
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_CN">
  <head>
    <meta charset="utf-8" />
    <title>curses --- 终端字符单元显示的处理 &#8212; Python 3.7.8 文档</title>
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/translations.js"></script>
    
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    
    <link rel="search" type="application/opensearchdescription+xml"
          title="在 Python 3.7.8 文档 中搜索"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="关于这些文档" href="../about.html" />
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="copyright" title="版权所有" href="../copyright.html" />
    <link rel="next" title="curses.ascii --- Utilities for ASCII characters" href="curses.ascii.html" />
    <link rel="prev" title="getpass --- 便携式密码输入工具" href="getpass.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/3/library/curses.html" />
    
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
    
    
    
    <style>
      @media only screen {
        table.full-width-table {
            width: 100%;
        }
      }
    </style>
 

  </head><body>
  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="总目录"
             accesskey="I">索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="curses.ascii.html" title="curses.ascii --- Utilities for ASCII characters"
             accesskey="N">下一页</a> |</li>
        <li class="right" >
          <a href="getpass.html" title="getpass --- 便携式密码输入工具"
             accesskey="P">上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">3.7.8 Documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >Python 标准库</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="allos.html" accesskey="U">通用操作系统服务</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="快速搜索" type="text" name="q" />
          <input type="submit" value="转向" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-curses">
<span id="curses-terminal-handling-for-character-cell-displays"></span><h1><a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> --- 终端字符单元显示的处理<a class="headerlink" href="#module-curses" title="永久链接至标题">¶</a></h1>
<hr class="docutils" />
<p><a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> 模块提供了 curses 库的接口，这是可移植高级终端处理的事实标准。</p>
<p>虽然 curses 在 Unix 环境中使用最为广泛，但也有适用于 Windows，DOS 以及其他可能的系统的版本。此扩展模块旨在匹配 ncurses 的 API，这是一个部署在 Linux 和 Unix 的 BSD 变体上的开源 curses 库。</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>每当文档提到 <strong>字符</strong> 时，它可以被指定为一个整数，一个单字符 Unicode 字符串或者一个单字节的字节字符串。</p>
<p>每当此文档提到 <strong>字符串</strong> 时，它可以被指定为一个 Unicode 字符串或者一个字节字符串。</p>
</div>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>从 5.4 版本开始，ncurses 库使用 <code class="docutils literal notranslate"><span class="pre">nl_langinfo</span></code> 函数来决定如何解释非 ASCII 数据。这意味着你需要在程序中调用 <a class="reference internal" href="locale.html#locale.setlocale" title="locale.setlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">locale.setlocale()</span></code></a> 函数，并使用一种系统中可用的编码方法来编码 Unicode 字符串。这个例子使用了系统默认的编码:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">locale</span>
<span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">)</span>
<span class="n">code</span> <span class="o">=</span> <span class="n">locale</span><span class="o">.</span><span class="n">getpreferredencoding</span><span class="p">()</span>
</pre></div>
</div>
<p>然后使用 <em>code</em> 作为 <a class="reference internal" href="stdtypes.html#str.encode" title="str.encode"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.encode()</span></code></a> 调用的编码。</p>
</div>
<div class="admonition seealso">
<p class="admonition-title">参见</p>
<dl class="simple">
<dt>模块 <a class="reference internal" href="curses.ascii.html#module-curses.ascii" title="curses.ascii: Constants and set-membership functions for ASCII characters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.ascii</span></code></a></dt><dd><p>在 ASCII 字符上工作的工具，无论你的区域设置是什么。</p>
</dd>
<dt>模块 <a class="reference internal" href="curses.panel.html#module-curses.panel" title="curses.panel: A panel stack extension that adds depth to  curses windows."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.panel</span></code></a></dt><dd><p>A panel stack extension that adds depth to  curses windows.</p>
</dd>
<dt>Module <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.textpad</span></code></a></dt><dd><p>Editable text widget for curses supporting  <strong class="program">Emacs</strong>-like bindings.</p>
</dd>
<dt><a class="reference internal" href="../howto/curses.html#curses-howto"><span class="std std-ref">用 Python 进行 Curses 编程</span></a></dt><dd><p>Tutorial material on using curses with Python, by Andrew Kuchling and Eric
Raymond.</p>
</dd>
</dl>
<p>The <a class="reference external" href="https://github.com/python/cpython/tree/3.7/Tools/demo/">Tools/demo/</a> directory in the Python source distribution contains
some example programs using the curses bindings provided by this module.</p>
</div>
<div class="section" id="functions">
<span id="curses-functions"></span><h2>函数<a class="headerlink" href="#functions" title="永久链接至标题">¶</a></h2>
<p><a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> 模块定义了以下异常：</p>
<dl class="exception">
<dt id="curses.error">
<em class="property">exception </em><code class="sig-prename descclassname">curses.</code><code class="sig-name descname">error</code><a class="headerlink" href="#curses.error" title="永久链接至目标">¶</a></dt>
<dd><p>当 curses 库中函数返回一个错误时引发的异常。</p>
</dd></dl>

<div class="admonition note">
<p class="admonition-title">注解</p>
<p>Whenever <em>x</em> or <em>y</em> arguments to a function or a method are optional, they
default to the current cursor location. Whenever <em>attr</em> is optional, it defaults
to <code class="xref py py-const docutils literal notranslate"><span class="pre">A_NORMAL</span></code>.</p>
</div>
<p><a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> 模块定义了以下函数：</p>
<dl class="function">
<dt id="curses.baudrate">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">baudrate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.baudrate" title="永久链接至目标">¶</a></dt>
<dd><p>Return the output speed of the terminal in bits per second.  On software
terminal emulators it will have a fixed high value. Included for historical
reasons; in former times, it was used to  write output loops for time delays and
occasionally to change interfaces depending on the line speed.</p>
</dd></dl>

<dl class="function">
<dt id="curses.beep">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">beep</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.beep" title="永久链接至目标">¶</a></dt>
<dd><p>Emit a short attention sound.</p>
</dd></dl>

<dl class="function">
<dt id="curses.can_change_color">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">can_change_color</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.can_change_color" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>, depending on whether the programmer can change the colors
displayed by the terminal.</p>
</dd></dl>

<dl class="function">
<dt id="curses.cbreak">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">cbreak</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.cbreak" title="永久链接至目标">¶</a></dt>
<dd><p>Enter cbreak mode.  In cbreak mode (sometimes called &quot;rare&quot; mode) normal tty
line buffering is turned off and characters are available to be read one by one.
However, unlike raw mode, special characters (interrupt, quit, suspend, and flow
control) retain their effects on the tty driver and calling program.  Calling
first <a class="reference internal" href="#curses.raw" title="curses.raw"><code class="xref py py-func docutils literal notranslate"><span class="pre">raw()</span></code></a> then <a class="reference internal" href="#curses.cbreak" title="curses.cbreak"><code class="xref py py-func docutils literal notranslate"><span class="pre">cbreak()</span></code></a> leaves the terminal in cbreak mode.</p>
</dd></dl>

<dl class="function">
<dt id="curses.color_content">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">color_content</code><span class="sig-paren">(</span><em class="sig-param">color_number</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.color_content" title="永久链接至目标">¶</a></dt>
<dd><p>Return the intensity of the red, green, and blue (RGB) components in the color
<em>color_number</em>, which must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and <code class="xref py py-const docutils literal notranslate"><span class="pre">COLORS</span></code>.  Return a 3-tuple,
containing the R,G,B values for the given color, which will be between
<code class="docutils literal notranslate"><span class="pre">0</span></code> (no component) and <code class="docutils literal notranslate"><span class="pre">1000</span></code> (maximum amount of component).</p>
</dd></dl>

<dl class="function">
<dt id="curses.color_pair">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">color_pair</code><span class="sig-paren">(</span><em class="sig-param">color_number</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.color_pair" title="永久链接至目标">¶</a></dt>
<dd><p>Return the attribute value for displaying text in the specified color.  This
attribute value can be combined with <code class="xref py py-const docutils literal notranslate"><span class="pre">A_STANDOUT</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">A_REVERSE</span></code>,
and the other <code class="xref py py-const docutils literal notranslate"><span class="pre">A_*</span></code> attributes.  <a class="reference internal" href="#curses.pair_number" title="curses.pair_number"><code class="xref py py-func docutils literal notranslate"><span class="pre">pair_number()</span></code></a> is the counterpart
to this function.</p>
</dd></dl>

<dl class="function">
<dt id="curses.curs_set">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">curs_set</code><span class="sig-paren">(</span><em class="sig-param">visibility</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.curs_set" title="永久链接至目标">¶</a></dt>
<dd><p>Set the cursor state.  <em>visibility</em> can be set to <code class="docutils literal notranslate"><span class="pre">0</span></code>, <code class="docutils literal notranslate"><span class="pre">1</span></code>, or <code class="docutils literal notranslate"><span class="pre">2</span></code>, for invisible,
normal, or very visible.  If the terminal supports the visibility requested, return the
previous cursor state; otherwise raise an exception.  On many
terminals, the &quot;visible&quot; mode is an underline cursor and the &quot;very visible&quot; mode
is a block cursor.</p>
</dd></dl>

<dl class="function">
<dt id="curses.def_prog_mode">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">def_prog_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.def_prog_mode" title="永久链接至目标">¶</a></dt>
<dd><p>Save the current terminal mode as the &quot;program&quot; mode, the mode when the running
program is using curses.  (Its counterpart is the &quot;shell&quot; mode, for when the
program is not in curses.)  Subsequent calls to <a class="reference internal" href="#curses.reset_prog_mode" title="curses.reset_prog_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">reset_prog_mode()</span></code></a> will
restore this mode.</p>
</dd></dl>

<dl class="function">
<dt id="curses.def_shell_mode">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">def_shell_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.def_shell_mode" title="永久链接至目标">¶</a></dt>
<dd><p>Save the current terminal mode as the &quot;shell&quot; mode, the mode when the running
program is not using curses.  (Its counterpart is the &quot;program&quot; mode, when the
program is using curses capabilities.) Subsequent calls to
<a class="reference internal" href="#curses.reset_shell_mode" title="curses.reset_shell_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">reset_shell_mode()</span></code></a> will restore this mode.</p>
</dd></dl>

<dl class="function">
<dt id="curses.delay_output">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">delay_output</code><span class="sig-paren">(</span><em class="sig-param">ms</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.delay_output" title="永久链接至目标">¶</a></dt>
<dd><p>Insert an <em>ms</em> millisecond pause in output.</p>
</dd></dl>

<dl class="function">
<dt id="curses.doupdate">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">doupdate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.doupdate" title="永久链接至目标">¶</a></dt>
<dd><p>Update the physical screen.  The curses library keeps two data structures, one
representing the current physical screen contents and a virtual screen
representing the desired next state.  The <a class="reference internal" href="#curses.doupdate" title="curses.doupdate"><code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code></a> ground updates the
physical screen to match the virtual screen.</p>
<p>The virtual screen may be updated by a <a class="reference internal" href="#curses.window.noutrefresh" title="curses.window.noutrefresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code></a> call after write
operations such as <a class="reference internal" href="#curses.window.addstr" title="curses.window.addstr"><code class="xref py py-meth docutils literal notranslate"><span class="pre">addstr()</span></code></a> have been performed on a window.  The normal
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> call is simply <code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code> followed by <code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code>;
if you have to update multiple windows, you can speed performance and perhaps
reduce screen flicker by issuing <code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code> calls on all windows,
followed by a single <code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.echo">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">echo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.echo" title="永久链接至目标">¶</a></dt>
<dd><p>Enter echo mode.  In echo mode, each character input is echoed to the screen as
it is entered.</p>
</dd></dl>

<dl class="function">
<dt id="curses.endwin">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">endwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.endwin" title="永久链接至目标">¶</a></dt>
<dd><p>De-initialize the library, and return terminal to normal status.</p>
</dd></dl>

<dl class="function">
<dt id="curses.erasechar">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">erasechar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.erasechar" title="永久链接至目标">¶</a></dt>
<dd><p>Return the user's current erase character as a one-byte bytes object.  Under Unix operating systems this
is a property of the controlling tty of the curses program, and is not set by
the curses library itself.</p>
</dd></dl>

<dl class="function">
<dt id="curses.filter">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">filter</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.filter" title="永久链接至目标">¶</a></dt>
<dd><p>The <a class="reference internal" href="#curses.filter" title="curses.filter"><code class="xref py py-func docutils literal notranslate"><span class="pre">filter()</span></code></a> routine, if used, must be called before <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a> is
called.  The effect is that, during those calls, <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code> is set to <code class="docutils literal notranslate"><span class="pre">1</span></code>; the
capabilities <code class="docutils literal notranslate"><span class="pre">clear</span></code>, <code class="docutils literal notranslate"><span class="pre">cup</span></code>, <code class="docutils literal notranslate"><span class="pre">cud</span></code>, <code class="docutils literal notranslate"><span class="pre">cud1</span></code>, <code class="docutils literal notranslate"><span class="pre">cuu1</span></code>, <code class="docutils literal notranslate"><span class="pre">cuu</span></code>, <code class="docutils literal notranslate"><span class="pre">vpa</span></code> are disabled; and the <code class="docutils literal notranslate"><span class="pre">home</span></code>
string is set to the value of <code class="docutils literal notranslate"><span class="pre">cr</span></code>. The effect is that the cursor is confined to
the current line, and so are screen updates.  This may be used for enabling
character-at-a-time  line editing without touching the rest of the screen.</p>
</dd></dl>

<dl class="function">
<dt id="curses.flash">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">flash</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.flash" title="永久链接至目标">¶</a></dt>
<dd><p>Flash the screen.  That is, change it to reverse-video and then change it back
in a short interval.  Some people prefer such as 'visible bell' to the audible
attention signal produced by <a class="reference internal" href="#curses.beep" title="curses.beep"><code class="xref py py-func docutils literal notranslate"><span class="pre">beep()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.flushinp">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">flushinp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.flushinp" title="永久链接至目标">¶</a></dt>
<dd><p>Flush all input buffers.  This throws away any  typeahead  that  has been typed
by the user and has not yet been processed by the program.</p>
</dd></dl>

<dl class="function">
<dt id="curses.getmouse">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">getmouse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.getmouse" title="永久链接至目标">¶</a></dt>
<dd><p>After <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> returns <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_MOUSE</span></code> to signal a mouse event, this
method should be call to retrieve the queued mouse event, represented as a
5-tuple <code class="docutils literal notranslate"><span class="pre">(id,</span> <span class="pre">x,</span> <span class="pre">y,</span> <span class="pre">z,</span> <span class="pre">bstate)</span></code>. <em>id</em> is an ID value used to distinguish
multiple devices, and <em>x</em>, <em>y</em>, <em>z</em> are the event's coordinates.  (<em>z</em> is
currently unused.)  <em>bstate</em> is an integer value whose bits will be set to
indicate the type of event, and will be the bitwise OR of one or more of the
following constants, where <em>n</em> is the button number from 1 to 4:
<code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_PRESSED</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_RELEASED</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_CLICKED</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_DOUBLE_CLICKED</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_TRIPLE_CLICKED</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTON_SHIFT</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTON_CTRL</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTON_ALT</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.getsyx">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">getsyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.getsyx" title="永久链接至目标">¶</a></dt>
<dd><p>Return the current coordinates of the virtual screen cursor as a tuple
<code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code>.  If <a class="reference internal" href="#curses.window.leaveok" title="curses.window.leaveok"><code class="xref py py-meth docutils literal notranslate"><span class="pre">leaveok</span></code></a> is currently <code class="docutils literal notranslate"><span class="pre">True</span></code>, then return <code class="docutils literal notranslate"><span class="pre">(-1,</span> <span class="pre">-1)</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.getwin">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">getwin</code><span class="sig-paren">(</span><em class="sig-param">file</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.getwin" title="永久链接至目标">¶</a></dt>
<dd><p>Read window related data stored in the file by an earlier <code class="xref py py-func docutils literal notranslate"><span class="pre">putwin()</span></code> call.
The routine then creates and initializes a new window using that data, returning
the new window object.</p>
</dd></dl>

<dl class="function">
<dt id="curses.has_colors">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">has_colors</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_colors" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the terminal can display colors; otherwise, return <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.has_ic">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">has_ic</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_ic" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the terminal has insert- and delete-character capabilities.
This function is included for historical reasons only, as all modern software
terminal emulators have such capabilities.</p>
</dd></dl>

<dl class="function">
<dt id="curses.has_il">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">has_il</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_il" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the terminal has insert- and delete-line capabilities, or can
simulate  them  using scrolling regions. This function is included for
historical reasons only, as all modern software terminal emulators have such
capabilities.</p>
</dd></dl>

<dl class="function">
<dt id="curses.has_key">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">has_key</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_key" title="永久链接至目标">¶</a></dt>
<dd><p>Take a key value <em>ch</em>, and return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the current terminal type recognizes
a key with that value.</p>
</dd></dl>

<dl class="function">
<dt id="curses.halfdelay">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">halfdelay</code><span class="sig-paren">(</span><em class="sig-param">tenths</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.halfdelay" title="永久链接至目标">¶</a></dt>
<dd><p>Used for half-delay mode, which is similar to cbreak mode in that characters
typed by the user are immediately available to the program. However, after
blocking for <em>tenths</em> tenths of seconds, raise an exception if nothing has
been typed.  The value of <em>tenths</em> must be a number between <code class="docutils literal notranslate"><span class="pre">1</span></code> and <code class="docutils literal notranslate"><span class="pre">255</span></code>.  Use
<a class="reference internal" href="#curses.nocbreak" title="curses.nocbreak"><code class="xref py py-func docutils literal notranslate"><span class="pre">nocbreak()</span></code></a> to leave half-delay mode.</p>
</dd></dl>

<dl class="function">
<dt id="curses.init_color">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">init_color</code><span class="sig-paren">(</span><em class="sig-param">color_number</em>, <em class="sig-param">r</em>, <em class="sig-param">g</em>, <em class="sig-param">b</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.init_color" title="永久链接至目标">¶</a></dt>
<dd><p>Change the definition of a color, taking the number of the color to be changed
followed by three RGB values (for the amounts of red, green, and blue
components).  The value of <em>color_number</em> must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and
<code class="xref py py-const docutils literal notranslate"><span class="pre">COLORS</span></code>.  Each of <em>r</em>, <em>g</em>, <em>b</em>, must be a value between <code class="docutils literal notranslate"><span class="pre">0</span></code> and
<code class="docutils literal notranslate"><span class="pre">1000</span></code>.  When <a class="reference internal" href="#curses.init_color" title="curses.init_color"><code class="xref py py-func docutils literal notranslate"><span class="pre">init_color()</span></code></a> is used, all occurrences of that color on the
screen immediately change to the new definition.  This function is a no-op on
most terminals; it is active only if <a class="reference internal" href="#curses.can_change_color" title="curses.can_change_color"><code class="xref py py-func docutils literal notranslate"><span class="pre">can_change_color()</span></code></a> returns <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.init_pair">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">init_pair</code><span class="sig-paren">(</span><em class="sig-param">pair_number</em>, <em class="sig-param">fg</em>, <em class="sig-param">bg</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.init_pair" title="永久链接至目标">¶</a></dt>
<dd><p>Change the definition of a color-pair.  It takes three arguments: the number of
the color-pair to be changed, the foreground color number, and the background
color number.  The value of <em>pair_number</em> must be between <code class="docutils literal notranslate"><span class="pre">1</span></code> and
<code class="docutils literal notranslate"><span class="pre">COLOR_PAIRS</span> <span class="pre">-</span> <span class="pre">1</span></code> (the <code class="docutils literal notranslate"><span class="pre">0</span></code> color pair is wired to white on black and cannot
be changed).  The value of <em>fg</em> and <em>bg</em> arguments must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and
<code class="xref py py-const docutils literal notranslate"><span class="pre">COLORS</span></code>.  If the color-pair was previously initialized, the screen is
refreshed and all occurrences of that color-pair are changed to the new
definition.</p>
</dd></dl>

<dl class="function">
<dt id="curses.initscr">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">initscr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.initscr" title="永久链接至目标">¶</a></dt>
<dd><p>Initialize the library. Return a <a class="reference internal" href="#curses-window-objects"><span class="std std-ref">window</span></a> object
which represents the whole screen.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>If there is an error opening the terminal, the underlying curses library may
cause the interpreter to exit.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="curses.is_term_resized">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">is_term_resized</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.is_term_resized" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <a class="reference internal" href="#curses.resize_term" title="curses.resize_term"><code class="xref py py-func docutils literal notranslate"><span class="pre">resize_term()</span></code></a> would modify the window structure,
<code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="curses.isendwin">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">isendwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.isendwin" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <a class="reference internal" href="#curses.endwin" title="curses.endwin"><code class="xref py py-func docutils literal notranslate"><span class="pre">endwin()</span></code></a> has been called (that is, the  curses library has
been deinitialized).</p>
</dd></dl>

<dl class="function">
<dt id="curses.keyname">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">keyname</code><span class="sig-paren">(</span><em class="sig-param">k</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.keyname" title="永久链接至目标">¶</a></dt>
<dd><p>Return the name of the key numbered <em>k</em> as a bytes object.  The name of a key generating printable
ASCII character is the key's character.  The name of a control-key combination
is a two-byte bytes object consisting of a caret (<code class="docutils literal notranslate"><span class="pre">b'^'</span></code>) followed by the corresponding
printable ASCII character.  The name of an alt-key combination (128--255) is a
bytes object consisting of the prefix <code class="docutils literal notranslate"><span class="pre">b'M-'</span></code> followed by the name of the corresponding
ASCII character.</p>
</dd></dl>

<dl class="function">
<dt id="curses.killchar">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">killchar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.killchar" title="永久链接至目标">¶</a></dt>
<dd><p>Return the user's current line kill character as a one-byte bytes object. Under Unix operating systems
this is a property of the controlling tty of the curses program, and is not set
by the curses library itself.</p>
</dd></dl>

<dl class="function">
<dt id="curses.longname">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">longname</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.longname" title="永久链接至目标">¶</a></dt>
<dd><p>Return a bytes object containing the terminfo long name field describing the current
terminal.  The maximum length of a verbose description is 128 characters.  It is
defined only after the call to <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.meta">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">meta</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.meta" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, allow 8-bit characters to be input.  If
<em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>,  allow only 7-bit chars.</p>
</dd></dl>

<dl class="function">
<dt id="curses.mouseinterval">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">mouseinterval</code><span class="sig-paren">(</span><em class="sig-param">interval</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.mouseinterval" title="永久链接至目标">¶</a></dt>
<dd><p>Set the maximum time in milliseconds that can elapse between press and release
events in order for them to be recognized as a click, and return the previous
interval value.  The default value is 200 msec, or one fifth of a second.</p>
</dd></dl>

<dl class="function">
<dt id="curses.mousemask">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">mousemask</code><span class="sig-paren">(</span><em class="sig-param">mousemask</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.mousemask" title="永久链接至目标">¶</a></dt>
<dd><p>Set the mouse events to be reported, and return a tuple <code class="docutils literal notranslate"><span class="pre">(availmask,</span>
<span class="pre">oldmask)</span></code>.   <em>availmask</em> indicates which of the specified mouse events can be
reported; on complete failure it returns <code class="docutils literal notranslate"><span class="pre">0</span></code>.  <em>oldmask</em> is the previous value of
the given window's mouse event mask.  If this function is never called, no mouse
events are ever reported.</p>
</dd></dl>

<dl class="function">
<dt id="curses.napms">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">napms</code><span class="sig-paren">(</span><em class="sig-param">ms</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.napms" title="永久链接至目标">¶</a></dt>
<dd><p>Sleep for <em>ms</em> milliseconds.</p>
</dd></dl>

<dl class="function">
<dt id="curses.newpad">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">newpad</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.newpad" title="永久链接至目标">¶</a></dt>
<dd><p>Create and return a pointer to a new pad data structure with the given number
of lines and columns.  Return a pad as a window object.</p>
<p>A pad is like a window, except that it is not restricted by the screen size, and
is not necessarily associated with a particular part of the screen.  Pads can be
used when a large window is needed, and only a part of the window will be on the
screen at one time.  Automatic refreshes of pads (such as from scrolling or
echoing of input) do not occur.  The <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> and <a class="reference internal" href="#curses.window.noutrefresh" title="curses.window.noutrefresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code></a>
methods of a pad require 6 arguments to specify the part of the pad to be
displayed and the location on the screen to be used for the display. The
arguments are <em>pminrow</em>, <em>pmincol</em>, <em>sminrow</em>, <em>smincol</em>, <em>smaxrow</em>, <em>smaxcol</em>; the <em>p</em>
arguments refer to the upper left corner of the pad region to be displayed and
the <em>s</em> arguments define a clipping box on the screen within which the pad region
is to be displayed.</p>
</dd></dl>

<dl class="function">
<dt id="curses.newwin">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">newwin</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.newwin" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">newwin</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em>, <em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span></dt>
<dd><p>Return a new <a class="reference internal" href="#curses-window-objects"><span class="std std-ref">window</span></a>, whose left-upper corner
is at  <code class="docutils literal notranslate"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and whose height/width is  <em>nlines</em>/<em>ncols</em>.</p>
<p>By default, the window will extend from the  specified position to the lower
right corner of the screen.</p>
</dd></dl>

<dl class="function">
<dt id="curses.nl">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">nl</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nl" title="永久链接至目标">¶</a></dt>
<dd><p>Enter newline mode.  This mode translates the return key into newline on input,
and translates newline into return and line-feed on output. Newline mode is
initially on.</p>
</dd></dl>

<dl class="function">
<dt id="curses.nocbreak">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">nocbreak</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nocbreak" title="永久链接至目标">¶</a></dt>
<dd><p>Leave cbreak mode.  Return to normal &quot;cooked&quot; mode with line buffering.</p>
</dd></dl>

<dl class="function">
<dt id="curses.noecho">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">noecho</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noecho" title="永久链接至目标">¶</a></dt>
<dd><p>Leave echo mode.  Echoing of input characters is turned off.</p>
</dd></dl>

<dl class="function">
<dt id="curses.nonl">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">nonl</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nonl" title="永久链接至目标">¶</a></dt>
<dd><p>Leave newline mode.  Disable translation of return into newline on input, and
disable low-level translation of newline into newline/return on output (but this
does not change the behavior of <code class="docutils literal notranslate"><span class="pre">addch('\n')</span></code>, which always does the
equivalent of return and line feed on the virtual screen).  With translation
off, curses can sometimes speed up vertical motion a little; also, it will be
able to detect the return key on input.</p>
</dd></dl>

<dl class="function">
<dt id="curses.noqiflush">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">noqiflush</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noqiflush" title="永久链接至目标">¶</a></dt>
<dd><p>When the <code class="xref py py-func docutils literal notranslate"><span class="pre">noqiflush()</span></code> routine is used, normal flush of input and output queues
associated with the <code class="docutils literal notranslate"><span class="pre">INTR</span></code>, <code class="docutils literal notranslate"><span class="pre">QUIT</span></code> and <code class="docutils literal notranslate"><span class="pre">SUSP</span></code> characters will not be done.  You may
want to call <code class="xref py py-func docutils literal notranslate"><span class="pre">noqiflush()</span></code> in a signal handler if you want output to
continue as though the interrupt had not occurred, after the handler exits.</p>
</dd></dl>

<dl class="function">
<dt id="curses.noraw">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">noraw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noraw" title="永久链接至目标">¶</a></dt>
<dd><p>Leave raw mode. Return to normal &quot;cooked&quot; mode with line buffering.</p>
</dd></dl>

<dl class="function">
<dt id="curses.pair_content">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">pair_content</code><span class="sig-paren">(</span><em class="sig-param">pair_number</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.pair_content" title="永久链接至目标">¶</a></dt>
<dd><p>Return a tuple <code class="docutils literal notranslate"><span class="pre">(fg,</span> <span class="pre">bg)</span></code> containing the colors for the requested color pair.
The value of <em>pair_number</em> must be between <code class="docutils literal notranslate"><span class="pre">1</span></code> and <code class="docutils literal notranslate"><span class="pre">COLOR_PAIRS</span> <span class="pre">-</span> <span class="pre">1</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.pair_number">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">pair_number</code><span class="sig-paren">(</span><em class="sig-param">attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.pair_number" title="永久链接至目标">¶</a></dt>
<dd><p>Return the number of the color-pair set by the attribute value <em>attr</em>.
<a class="reference internal" href="#curses.color_pair" title="curses.color_pair"><code class="xref py py-func docutils literal notranslate"><span class="pre">color_pair()</span></code></a> is the counterpart to this function.</p>
</dd></dl>

<dl class="function">
<dt id="curses.putp">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">putp</code><span class="sig-paren">(</span><em class="sig-param">str</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.putp" title="永久链接至目标">¶</a></dt>
<dd><p>Equivalent to <code class="docutils literal notranslate"><span class="pre">tputs(str,</span> <span class="pre">1,</span> <span class="pre">putchar)</span></code>; emit the value of a specified
terminfo capability for the current terminal.  Note that the output of <a class="reference internal" href="#curses.putp" title="curses.putp"><code class="xref py py-func docutils literal notranslate"><span class="pre">putp()</span></code></a>
always goes to standard output.</p>
</dd></dl>

<dl class="function">
<dt id="curses.qiflush">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">qiflush</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.qiflush" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, the effect is the same as calling <a class="reference internal" href="#curses.noqiflush" title="curses.noqiflush"><code class="xref py py-func docutils literal notranslate"><span class="pre">noqiflush()</span></code></a>. If
<em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, or no argument is provided, the queues will be flushed when
these control characters are read.</p>
</dd></dl>

<dl class="function">
<dt id="curses.raw">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">raw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.raw" title="永久链接至目标">¶</a></dt>
<dd><p>Enter raw mode.  In raw mode, normal line buffering and  processing of
interrupt, quit, suspend, and flow control keys are turned off; characters are
presented to curses input functions one by one.</p>
</dd></dl>

<dl class="function">
<dt id="curses.reset_prog_mode">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">reset_prog_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.reset_prog_mode" title="永久链接至目标">¶</a></dt>
<dd><p>Restore the  terminal  to &quot;program&quot; mode, as previously saved  by
<a class="reference internal" href="#curses.def_prog_mode" title="curses.def_prog_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">def_prog_mode()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.reset_shell_mode">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">reset_shell_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.reset_shell_mode" title="永久链接至目标">¶</a></dt>
<dd><p>Restore the  terminal  to &quot;shell&quot; mode, as previously saved  by
<a class="reference internal" href="#curses.def_shell_mode" title="curses.def_shell_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">def_shell_mode()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.resetty">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">resetty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.resetty" title="永久链接至目标">¶</a></dt>
<dd><p>Restore the state of the terminal modes to what it was at the last call to
<a class="reference internal" href="#curses.savetty" title="curses.savetty"><code class="xref py py-func docutils literal notranslate"><span class="pre">savetty()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.resize_term">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">resize_term</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.resize_term" title="永久链接至目标">¶</a></dt>
<dd><p>Backend function used by <a class="reference internal" href="#curses.resizeterm" title="curses.resizeterm"><code class="xref py py-func docutils literal notranslate"><span class="pre">resizeterm()</span></code></a>, performing most of the work;
when resizing the windows, <a class="reference internal" href="#curses.resize_term" title="curses.resize_term"><code class="xref py py-func docutils literal notranslate"><span class="pre">resize_term()</span></code></a> blank-fills the areas that are
extended.  The calling application should fill in these areas with
appropriate data.  The <code class="xref py py-func docutils literal notranslate"><span class="pre">resize_term()</span></code> function attempts to resize all
windows.  However, due to the calling convention of pads, it is not possible
to resize these without additional interaction with the application.</p>
</dd></dl>

<dl class="function">
<dt id="curses.resizeterm">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">resizeterm</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.resizeterm" title="永久链接至目标">¶</a></dt>
<dd><p>Resize the standard and current windows to the specified dimensions, and
adjusts other bookkeeping data used by the curses library that record the
window dimensions (in particular the SIGWINCH handler).</p>
</dd></dl>

<dl class="function">
<dt id="curses.savetty">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">savetty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.savetty" title="永久链接至目标">¶</a></dt>
<dd><p>Save the current state of the terminal modes in a buffer, usable by
<a class="reference internal" href="#curses.resetty" title="curses.resetty"><code class="xref py py-func docutils literal notranslate"><span class="pre">resetty()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.setsyx">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">setsyx</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.setsyx" title="永久链接至目标">¶</a></dt>
<dd><p>Set the virtual screen cursor to <em>y</em>, <em>x</em>. If <em>y</em> and <em>x</em> are both <code class="docutils literal notranslate"><span class="pre">-1</span></code>, then
<a class="reference internal" href="#curses.window.leaveok" title="curses.window.leaveok"><code class="xref py py-meth docutils literal notranslate"><span class="pre">leaveok</span></code></a> is set <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="curses.setupterm">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">setupterm</code><span class="sig-paren">(</span><em class="sig-param">term=None</em>, <em class="sig-param">fd=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.setupterm" title="永久链接至目标">¶</a></dt>
<dd><p>Initialize the terminal.  <em>term</em> is a string giving
the terminal name, or <code class="docutils literal notranslate"><span class="pre">None</span></code>; if omitted or <code class="docutils literal notranslate"><span class="pre">None</span></code>, the value of the
<span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">TERM</span></code> environment variable will be used.  <em>fd</em> is the
file descriptor to which any initialization sequences will be sent; if not
supplied or <code class="docutils literal notranslate"><span class="pre">-1</span></code>, the file descriptor for <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code> will be used.</p>
</dd></dl>

<dl class="function">
<dt id="curses.start_color">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">start_color</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.start_color" title="永久链接至目标">¶</a></dt>
<dd><p>Must be called if the programmer wants to use colors, and before any other color
manipulation routine is called.  It is good practice to call this routine right
after <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a>.</p>
<p><a class="reference internal" href="#curses.start_color" title="curses.start_color"><code class="xref py py-func docutils literal notranslate"><span class="pre">start_color()</span></code></a> initializes eight basic colors (black, red,  green, yellow,
blue, magenta, cyan, and white), and two global variables in the <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a>
module, <code class="xref py py-const docutils literal notranslate"><span class="pre">COLORS</span></code> and <code class="xref py py-const docutils literal notranslate"><span class="pre">COLOR_PAIRS</span></code>, containing the maximum number
of colors and color-pairs the terminal can support.  It also restores the colors
on the terminal to the values they had when the terminal was just turned on.</p>
</dd></dl>

<dl class="function">
<dt id="curses.termattrs">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">termattrs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.termattrs" title="永久链接至目标">¶</a></dt>
<dd><p>Return a logical OR of all video attributes supported by the terminal.  This
information is useful when a curses program needs complete control over the
appearance of the screen.</p>
</dd></dl>

<dl class="function">
<dt id="curses.termname">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">termname</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.termname" title="永久链接至目标">¶</a></dt>
<dd><p>Return the value of the environment variable <span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">TERM</span></code>, as a bytes object,
truncated to 14 characters.</p>
</dd></dl>

<dl class="function">
<dt id="curses.tigetflag">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">tigetflag</code><span class="sig-paren">(</span><em class="sig-param">capname</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetflag" title="永久链接至目标">¶</a></dt>
<dd><p>Return the value of the Boolean capability corresponding to the terminfo
capability name <em>capname</em> as an integer.  Return the value <code class="docutils literal notranslate"><span class="pre">-1</span></code> if <em>capname</em> is not a
Boolean capability, or <code class="docutils literal notranslate"><span class="pre">0</span></code> if it is canceled or absent from the terminal
description.</p>
</dd></dl>

<dl class="function">
<dt id="curses.tigetnum">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">tigetnum</code><span class="sig-paren">(</span><em class="sig-param">capname</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetnum" title="永久链接至目标">¶</a></dt>
<dd><p>Return the value of the numeric capability corresponding to the terminfo
capability name <em>capname</em> as an integer.  Return the value <code class="docutils literal notranslate"><span class="pre">-2</span></code> if <em>capname</em> is not a
numeric capability, or <code class="docutils literal notranslate"><span class="pre">-1</span></code> if it is canceled or absent from the terminal
description.</p>
</dd></dl>

<dl class="function">
<dt id="curses.tigetstr">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">tigetstr</code><span class="sig-paren">(</span><em class="sig-param">capname</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetstr" title="永久链接至目标">¶</a></dt>
<dd><p>Return the value of the string capability corresponding to the terminfo
capability name <em>capname</em> as a bytes object.  Return <code class="docutils literal notranslate"><span class="pre">None</span></code> if <em>capname</em>
is not a terminfo &quot;string capability&quot;, or is canceled or absent from the
terminal description.</p>
</dd></dl>

<dl class="function">
<dt id="curses.tparm">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">tparm</code><span class="sig-paren">(</span><em class="sig-param">str</em><span class="optional">[</span>, <em class="sig-param">...</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.tparm" title="永久链接至目标">¶</a></dt>
<dd><p>Instantiate the bytes object <em>str</em> with the supplied parameters, where <em>str</em> should
be a parameterized string obtained from the terminfo database.  E.g.
<code class="docutils literal notranslate"><span class="pre">tparm(tigetstr(&quot;cup&quot;),</span> <span class="pre">5,</span> <span class="pre">3)</span></code> could result in <code class="docutils literal notranslate"><span class="pre">b'\033[6;4H'</span></code>, the exact
result depending on terminal type.</p>
</dd></dl>

<dl class="function">
<dt id="curses.typeahead">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">typeahead</code><span class="sig-paren">(</span><em class="sig-param">fd</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.typeahead" title="永久链接至目标">¶</a></dt>
<dd><p>Specify that the file descriptor <em>fd</em> be used for typeahead checking.  If <em>fd</em>
is <code class="docutils literal notranslate"><span class="pre">-1</span></code>, then no typeahead checking is done.</p>
<p>The curses library does &quot;line-breakout optimization&quot; by looking for typeahead
periodically while updating the screen.  If input is found, and it is coming
from a tty, the current update is postponed until refresh or doupdate is called
again, allowing faster response to commands typed in advance. This function
allows specifying a different file descriptor for typeahead checking.</p>
</dd></dl>

<dl class="function">
<dt id="curses.unctrl">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">unctrl</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.unctrl" title="永久链接至目标">¶</a></dt>
<dd><p>Return a bytes object which is a printable representation of the character <em>ch</em>.
Control characters are represented as a caret followed by the character, for
example as <code class="docutils literal notranslate"><span class="pre">b'^C'</span></code>. Printing characters are left as they are.</p>
</dd></dl>

<dl class="function">
<dt id="curses.ungetch">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">ungetch</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.ungetch" title="永久链接至目标">¶</a></dt>
<dd><p>Push <em>ch</em> so the next <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> will return it.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>Only one <em>ch</em> can be pushed before <code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code> is called.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="curses.update_lines_cols">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">update_lines_cols</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.update_lines_cols" title="永久链接至目标">¶</a></dt>
<dd><p>Update <span class="target" id="index-3"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code> and <span class="target" id="index-4"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">COLS</span></code>. Useful for detecting manual screen resize.</p>
<div class="versionadded">
<p><span class="versionmodified added">3.5 新版功能.</span></p>
</div>
</dd></dl>

<dl class="function">
<dt id="curses.unget_wch">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">unget_wch</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.unget_wch" title="永久链接至目标">¶</a></dt>
<dd><p>Push <em>ch</em> so the next <a class="reference internal" href="#curses.window.get_wch" title="curses.window.get_wch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_wch()</span></code></a> will return it.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>Only one <em>ch</em> can be pushed before <code class="xref py py-meth docutils literal notranslate"><span class="pre">get_wch()</span></code> is called.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">3.3 新版功能.</span></p>
</div>
</dd></dl>

<dl class="function">
<dt id="curses.ungetmouse">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">ungetmouse</code><span class="sig-paren">(</span><em class="sig-param">id</em>, <em class="sig-param">x</em>, <em class="sig-param">y</em>, <em class="sig-param">z</em>, <em class="sig-param">bstate</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.ungetmouse" title="永久链接至目标">¶</a></dt>
<dd><p>Push a <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_MOUSE</span></code> event onto the input queue, associating the given
state data with it.</p>
</dd></dl>

<dl class="function">
<dt id="curses.use_env">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">use_env</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.use_env" title="永久链接至目标">¶</a></dt>
<dd><p>If used, this function should be called before <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a> or newterm are
called.  When <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, the values of lines and columns specified in the
terminfo database will be used, even if environment variables <span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code>
and <span class="target" id="index-6"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">COLUMNS</span></code> (used by default) are set, or if curses is running in a
window (in which case default behavior would be to use the window size if
<span class="target" id="index-7"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code> and <span class="target" id="index-8"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">COLUMNS</span></code> are not set).</p>
</dd></dl>

<dl class="function">
<dt id="curses.use_default_colors">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">use_default_colors</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.use_default_colors" title="永久链接至目标">¶</a></dt>
<dd><p>Allow use of default values for colors on terminals supporting this feature. Use
this to support transparency in your application.  The default color is assigned
to the color number <code class="docutils literal notranslate"><span class="pre">-1</span></code>. After calling this function,  <code class="docutils literal notranslate"><span class="pre">init_pair(x,</span>
<span class="pre">curses.COLOR_RED,</span> <span class="pre">-1)</span></code> initializes, for instance, color pair <em>x</em> to a red
foreground color on the default background.</p>
</dd></dl>

<dl class="function">
<dt id="curses.wrapper">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">wrapper</code><span class="sig-paren">(</span><em class="sig-param">func</em>, <em class="sig-param">...</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.wrapper" title="永久链接至目标">¶</a></dt>
<dd><p>Initialize curses and call another callable object, <em>func</em>, which should be the
rest of your curses-using application.  If the application raises an exception,
this function will restore the terminal to a sane state before re-raising the
exception and generating a traceback.  The callable object <em>func</em> is then passed
the main window 'stdscr' as its first argument, followed by any other arguments
passed to <code class="xref py py-func docutils literal notranslate"><span class="pre">wrapper()</span></code>.  Before calling <em>func</em>, <code class="xref py py-func docutils literal notranslate"><span class="pre">wrapper()</span></code> turns on
cbreak mode, turns off echo, enables the terminal keypad, and initializes colors
if the terminal has color support.  On exit (whether normally or by exception)
it restores cooked mode, turns on echo, and disables the terminal keypad.</p>
</dd></dl>

</div>
<div class="section" id="window-objects">
<span id="curses-window-objects"></span><h2>Window Objects<a class="headerlink" href="#window-objects" title="永久链接至标题">¶</a></h2>
<p>Window objects, as returned by <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a> and <a class="reference internal" href="#curses.newwin" title="curses.newwin"><code class="xref py py-func docutils literal notranslate"><span class="pre">newwin()</span></code></a> above, have
the following methods and attributes:</p>
<dl class="method">
<dt id="curses.window.addch">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">addch</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.addch" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">addch</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Paint character <em>ch</em> at <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes <em>attr</em>, overwriting any
character previously painter at that location.  By default, the character
position and attributes are the current settings for the window object.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>Writing outside the window, subwindow, or pad raises a <a class="reference internal" href="#curses.error" title="curses.error"><code class="xref py py-exc docutils literal notranslate"><span class="pre">curses.error</span></code></a>.
Attempting to write to the lower right corner of a window, subwindow,
or pad will cause an exception to be raised after the character is printed.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="curses.window.addnstr">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">addnstr</code><span class="sig-paren">(</span><em class="sig-param">str</em>, <em class="sig-param">n</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.addnstr" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">addnstr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">str</em>, <em class="sig-param">n</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Paint at most <em>n</em> characters of the character string <em>str</em> at
<code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes
<em>attr</em>, overwriting anything previously on the display.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.addstr">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">addstr</code><span class="sig-paren">(</span><em class="sig-param">str</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.addstr" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">addstr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">str</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Paint the character string <em>str</em> at <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes
<em>attr</em>, overwriting anything previously on the display.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>Writing outside the window, subwindow, or pad raises <a class="reference internal" href="#curses.error" title="curses.error"><code class="xref py py-exc docutils literal notranslate"><span class="pre">curses.error</span></code></a>.
Attempting to write to the lower right corner of a window, subwindow,
or pad will cause an exception to be raised after the string is printed.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="curses.window.attroff">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">attroff</code><span class="sig-paren">(</span><em class="sig-param">attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.attroff" title="永久链接至目标">¶</a></dt>
<dd><p>Remove attribute <em>attr</em> from the &quot;background&quot; set applied to all writes to the
current window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.attron">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">attron</code><span class="sig-paren">(</span><em class="sig-param">attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.attron" title="永久链接至目标">¶</a></dt>
<dd><p>Add attribute <em>attr</em> from the &quot;background&quot; set applied to all writes to the
current window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.attrset">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">attrset</code><span class="sig-paren">(</span><em class="sig-param">attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.attrset" title="永久链接至目标">¶</a></dt>
<dd><p>Set the &quot;background&quot; set of attributes to <em>attr</em>.  This set is initially
<code class="docutils literal notranslate"><span class="pre">0</span></code> (no attributes).</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.bkgd">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">bkgd</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.bkgd" title="永久链接至目标">¶</a></dt>
<dd><p>Set the background property of the window to the character <em>ch</em>, with
attributes <em>attr</em>.  The change is then applied to every character position in
that window:</p>
<ul class="simple">
<li><p>The attribute of every character in the window  is changed to the new
background attribute.</p></li>
<li><p>Wherever  the  former background character appears, it is changed to the new
background character.</p></li>
</ul>
</dd></dl>

<dl class="method">
<dt id="curses.window.bkgdset">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">bkgdset</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.bkgdset" title="永久链接至目标">¶</a></dt>
<dd><p>Set the window's background.  A window's background consists of a character and
any combination of attributes.  The attribute part of the background is combined
(OR'ed) with all non-blank characters that are written into the window.  Both
the character and attribute parts of the background are combined with the blank
characters.  The background becomes a property of the character and moves with
the character through any scrolling and insert/delete line/character operations.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.border">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">border</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">ls</em><span class="optional">[</span>, <em class="sig-param">rs</em><span class="optional">[</span>, <em class="sig-param">ts</em><span class="optional">[</span>, <em class="sig-param">bs</em><span class="optional">[</span>, <em class="sig-param">tl</em><span class="optional">[</span>, <em class="sig-param">tr</em><span class="optional">[</span>, <em class="sig-param">bl</em><span class="optional">[</span>, <em class="sig-param">br</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.border" title="永久链接至目标">¶</a></dt>
<dd><p>在窗口边缘绘制边框。每个参数指定用于边界特定部分的字符;请参阅下表了解更多详情。</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>A <code class="docutils literal notranslate"><span class="pre">0</span></code> value for any parameter will cause the default character to be used for
that parameter.  Keyword parameters can <em>not</em> be used.  The defaults are listed
in this table:</p>
</div>
<table class="docutils align-default">
<colgroup>
<col style="width: 20%" />
<col style="width: 38%" />
<col style="width: 42%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>参数</p></th>
<th class="head"><p>描述</p></th>
<th class="head"><p>默认值</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><em>ls</em></p></td>
<td><p>左侧</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_VLINE</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><em>rs</em></p></td>
<td><p>右侧</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_VLINE</span></code></p></td>
</tr>
<tr class="row-even"><td><p><em>ts</em></p></td>
<td><p>顶部</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_HLINE</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><em>bs</em></p></td>
<td><p>底部</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_HLINE</span></code></p></td>
</tr>
<tr class="row-even"><td><p><em>tl</em></p></td>
<td><p>左上角</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_ULCORNER</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><em>tr</em></p></td>
<td><p>右上角</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_URCORNER</span></code></p></td>
</tr>
<tr class="row-even"><td><p><em>bl</em></p></td>
<td><p>左下角</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_LLCORNER</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><em>br</em></p></td>
<td><p>右下角</p></td>
<td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">ACS_LRCORNER</span></code></p></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="curses.window.box">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">box</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">vertch</em>, <em class="sig-param">horch</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.box" title="永久链接至目标">¶</a></dt>
<dd><p>Similar to <a class="reference internal" href="#curses.window.border" title="curses.window.border"><code class="xref py py-meth docutils literal notranslate"><span class="pre">border()</span></code></a>, but both <em>ls</em> and <em>rs</em> are <em>vertch</em> and both <em>ts</em> and
<em>bs</em> are <em>horch</em>.  The default corner characters are always used by this function.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.chgat">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">chgat</code><span class="sig-paren">(</span><em class="sig-param">attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.chgat" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">chgat</code><span class="sig-paren">(</span><em class="sig-param">num</em>, <em class="sig-param">attr</em><span class="sig-paren">)</span></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">chgat</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">attr</em><span class="sig-paren">)</span></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">chgat</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">num</em>, <em class="sig-param">attr</em><span class="sig-paren">)</span></dt>
<dd><p>Set the attributes of <em>num</em> characters at the current cursor position, or at
position <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> if supplied. If <em>num</em> is not given or is <code class="docutils literal notranslate"><span class="pre">-1</span></code>,
the attribute will be set on all the characters to the end of the line.  This
function moves cursor to position <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> if supplied. The changed line
will be touched using the <a class="reference internal" href="#curses.window.touchline" title="curses.window.touchline"><code class="xref py py-meth docutils literal notranslate"><span class="pre">touchline()</span></code></a> method so that the contents will
be redisplayed by the next window refresh.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.clear">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clear" title="永久链接至目标">¶</a></dt>
<dd><p>Like <a class="reference internal" href="#curses.window.erase" title="curses.window.erase"><code class="xref py py-meth docutils literal notranslate"><span class="pre">erase()</span></code></a>, but also cause the whole window to be repainted upon next
call to <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.clearok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">clearok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clearok" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the next call to <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> will clear the window
completely.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.clrtobot">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">clrtobot</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clrtobot" title="永久链接至目标">¶</a></dt>
<dd><p>Erase from cursor to the end of the window: all lines below the cursor are
deleted, and then the equivalent of <a class="reference internal" href="#curses.window.clrtoeol" title="curses.window.clrtoeol"><code class="xref py py-meth docutils literal notranslate"><span class="pre">clrtoeol()</span></code></a> is performed.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.clrtoeol">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">clrtoeol</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clrtoeol" title="永久链接至目标">¶</a></dt>
<dd><p>Erase from cursor to the end of the line.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.cursyncup">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">cursyncup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.cursyncup" title="永久链接至目标">¶</a></dt>
<dd><p>Update the current cursor position of all the ancestors of the window to
reflect the current cursor position of the window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.delch">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">delch</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.delch" title="永久链接至目标">¶</a></dt>
<dd><p>Delete any character at <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.deleteln">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">deleteln</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.deleteln" title="永久链接至目标">¶</a></dt>
<dd><p>Delete the line under the cursor. All following lines are moved up by one line.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.derwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">derwin</code><span class="sig-paren">(</span><em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.derwin" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">derwin</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em>, <em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span></dt>
<dd><p>An abbreviation for &quot;derive window&quot;, <a class="reference internal" href="#curses.window.derwin" title="curses.window.derwin"><code class="xref py py-meth docutils literal notranslate"><span class="pre">derwin()</span></code></a> is the same as calling
<a class="reference internal" href="#curses.window.subwin" title="curses.window.subwin"><code class="xref py py-meth docutils literal notranslate"><span class="pre">subwin()</span></code></a>, except that <em>begin_y</em> and <em>begin_x</em> are relative to the origin
of the window, rather than relative to the entire screen.  Return a window
object for the derived window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.echochar">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">echochar</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.echochar" title="永久链接至目标">¶</a></dt>
<dd><p>Add character <em>ch</em> with attribute <em>attr</em>, and immediately  call <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>
on the window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.enclose">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">enclose</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.enclose" title="永久链接至目标">¶</a></dt>
<dd><p>Test whether the given pair of screen-relative character-cell coordinates are
enclosed by the given window, returning <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>.  It is useful for
determining what subset of the screen windows enclose the location of a mouse
event.</p>
</dd></dl>

<dl class="attribute">
<dt id="curses.window.encoding">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">encoding</code><a class="headerlink" href="#curses.window.encoding" title="永久链接至目标">¶</a></dt>
<dd><p>Encoding used to encode method arguments (Unicode strings and characters).
The encoding attribute is inherited from the parent window when a subwindow
is created, for example with <a class="reference internal" href="#curses.window.subwin" title="curses.window.subwin"><code class="xref py py-meth docutils literal notranslate"><span class="pre">window.subwin()</span></code></a>. By default, the locale
encoding is used (see <a class="reference internal" href="locale.html#locale.getpreferredencoding" title="locale.getpreferredencoding"><code class="xref py py-func docutils literal notranslate"><span class="pre">locale.getpreferredencoding()</span></code></a>).</p>
<div class="versionadded">
<p><span class="versionmodified added">3.3 新版功能.</span></p>
</div>
</dd></dl>

<dl class="method">
<dt id="curses.window.erase">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">erase</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.erase" title="永久链接至目标">¶</a></dt>
<dd><p>Clear the window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getbegyx">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getbegyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getbegyx" title="永久链接至目标">¶</a></dt>
<dd><p>Return a tuple <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> of co-ordinates of upper-left corner.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getbkgd">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getbkgd</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getbkgd" title="永久链接至目标">¶</a></dt>
<dd><p>Return the given window's current background character/attribute pair.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getch">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getch</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getch" title="永久链接至目标">¶</a></dt>
<dd><p>Get a character. Note that the integer returned does <em>not</em> have to be in ASCII
range: function keys, keypad keys and so on are represented by numbers higher
than 255.  In no-delay mode, return <code class="docutils literal notranslate"><span class="pre">-1</span></code> if there is no input, otherwise
wait until a key is pressed.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.get_wch">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">get_wch</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.get_wch" title="永久链接至目标">¶</a></dt>
<dd><p>Get a wide character. Return a character for most keys, or an integer for
function keys, keypad keys, and other special keys.
In no-delay mode, raise an exception if there is no input.</p>
<div class="versionadded">
<p><span class="versionmodified added">3.3 新版功能.</span></p>
</div>
</dd></dl>

<dl class="method">
<dt id="curses.window.getkey">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getkey</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getkey" title="永久链接至目标">¶</a></dt>
<dd><p>Get a character, returning a string instead of an integer, as <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a>
does. Function keys, keypad keys and other special keys return a multibyte
string containing the key name.  In no-delay mode, raise an exception if
there is no input.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getmaxyx">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getmaxyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getmaxyx" title="永久链接至目标">¶</a></dt>
<dd><p>Return a tuple <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> of the height and width of the window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getparyx">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getparyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getparyx" title="永久链接至目标">¶</a></dt>
<dd><p>Return the beginning coordinates of this window relative to its parent window
as a tuple <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code>.  Return <code class="docutils literal notranslate"><span class="pre">(-1,</span> <span class="pre">-1)</span></code> if this window has no
parent.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getstr">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getstr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getstr" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getstr</code><span class="sig-paren">(</span><em class="sig-param">n</em><span class="sig-paren">)</span></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getstr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="sig-paren">)</span></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getstr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">n</em><span class="sig-paren">)</span></dt>
<dd><p>Read a bytes object from the user, with primitive line editing capacity.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.getyx">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">getyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getyx" title="永久链接至目标">¶</a></dt>
<dd><p>Return a tuple <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> of current cursor position  relative to the window's
upper-left corner.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.hline">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">hline</code><span class="sig-paren">(</span><em class="sig-param">ch</em>, <em class="sig-param">n</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.hline" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">hline</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">ch</em>, <em class="sig-param">n</em><span class="sig-paren">)</span></dt>
<dd><p>Display a horizontal line starting at <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> with length <em>n</em> consisting of
the character <em>ch</em>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.idcok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">idcok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.idcok" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, curses no longer considers using the hardware insert/delete
character feature of the terminal; if <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, use of character insertion
and deletion is enabled.  When curses is first initialized, use of character
insert/delete is enabled by default.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.idlok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">idlok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.idlok" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> will try and use hardware line
editing facilities. Otherwise, line insertion/deletion are disabled.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.immedok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">immedok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.immedok" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, any change in the window image automatically causes the
window to be refreshed; you no longer have to call <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> yourself.
However, it may degrade performance considerably, due to repeated calls to
wrefresh.  This option is disabled by default.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.inch">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">inch</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.inch" title="永久链接至目标">¶</a></dt>
<dd><p>Return the character at the given position in the window. The bottom 8 bits are
the character proper, and upper bits are the attributes.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.insch">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insch</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insch" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insch</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">ch</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Paint character <em>ch</em> at <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes <em>attr</em>, moving the line from
position <em>x</em> right by one character.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.insdelln">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insdelln</code><span class="sig-paren">(</span><em class="sig-param">nlines</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insdelln" title="永久链接至目标">¶</a></dt>
<dd><p>Insert <em>nlines</em> lines into the specified window above the current line.  The
<em>nlines</em> bottom lines are lost.  For negative <em>nlines</em>, delete <em>nlines</em> lines
starting with the one under the cursor, and move the remaining lines up.  The
bottom <em>nlines</em> lines are cleared.  The current cursor position remains the
same.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.insertln">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insertln</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insertln" title="永久链接至目标">¶</a></dt>
<dd><p>Insert a blank line under the cursor. All following lines are moved down by one
line.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.insnstr">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insnstr</code><span class="sig-paren">(</span><em class="sig-param">str</em>, <em class="sig-param">n</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insnstr" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insnstr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">str</em>, <em class="sig-param">n</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Insert a character string (as many characters as will fit on the line) before
the character under the cursor, up to <em>n</em> characters.   If <em>n</em> is zero or
negative, the entire string is inserted. All characters to the right of the
cursor are shifted right, with the rightmost characters on the line being lost.
The cursor position does not change (after moving to <em>y</em>, <em>x</em>, if specified).</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.insstr">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insstr</code><span class="sig-paren">(</span><em class="sig-param">str</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insstr" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">insstr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">str</em><span class="optional">[</span>, <em class="sig-param">attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Insert a character string (as many characters as will fit on the line) before
the character under the cursor.  All characters to the right of the cursor are
shifted right, with the rightmost characters on the line being lost.  The cursor
position does not change (after moving to <em>y</em>, <em>x</em>, if specified).</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.instr">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">instr</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">n</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.instr" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">instr</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="optional">[</span>, <em class="sig-param">n</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><p>Return a bytes object of characters, extracted from the window starting at the
current cursor position, or at <em>y</em>, <em>x</em> if specified. Attributes are stripped
from the characters.  If <em>n</em> is specified, <a class="reference internal" href="#curses.window.instr" title="curses.window.instr"><code class="xref py py-meth docutils literal notranslate"><span class="pre">instr()</span></code></a> returns a string
at most <em>n</em> characters long (exclusive of the trailing NUL).</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.is_linetouched">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">is_linetouched</code><span class="sig-paren">(</span><em class="sig-param">line</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.is_linetouched" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the specified line was modified since the last call to
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>; otherwise return <code class="docutils literal notranslate"><span class="pre">False</span></code>.  Raise a <a class="reference internal" href="#curses.error" title="curses.error"><code class="xref py py-exc docutils literal notranslate"><span class="pre">curses.error</span></code></a>
exception if <em>line</em> is not valid for the given window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.is_wintouched">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">is_wintouched</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.is_wintouched" title="永久链接至目标">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the specified window was modified since the last call to
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>; otherwise return <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.keypad">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">keypad</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.keypad" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, escape sequences generated by some keys (keypad,  function keys)
will be interpreted by <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a>. If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, escape sequences will be
left as is in the input stream.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.leaveok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">leaveok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.leaveok" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, cursor is left where it is on update, instead of being at &quot;cursor
position.&quot;  This reduces cursor movement where possible. If possible the cursor
will be made invisible.</p>
<p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, cursor will always be at &quot;cursor position&quot; after an update.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.move">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">move</code><span class="sig-paren">(</span><em class="sig-param">new_y</em>, <em class="sig-param">new_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.move" title="永久链接至目标">¶</a></dt>
<dd><p>Move cursor to <code class="docutils literal notranslate"><span class="pre">(new_y,</span> <span class="pre">new_x)</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.mvderwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">mvderwin</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.mvderwin" title="永久链接至目标">¶</a></dt>
<dd><p>Move the window inside its parent window.  The screen-relative parameters of
the window are not changed.  This routine is used to display different parts of
the parent window at the same physical position on the screen.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.mvwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">mvwin</code><span class="sig-paren">(</span><em class="sig-param">new_y</em>, <em class="sig-param">new_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.mvwin" title="永久链接至目标">¶</a></dt>
<dd><p>Move the window so its upper-left corner is at <code class="docutils literal notranslate"><span class="pre">(new_y,</span> <span class="pre">new_x)</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.nodelay">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">nodelay</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.nodelay" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> will be non-blocking.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.notimeout">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">notimeout</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.notimeout" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, escape sequences will not be timed out.</p>
<p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, after a few milliseconds, an escape sequence will not be
interpreted, and will be left in the input stream as is.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.noutrefresh">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">noutrefresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.noutrefresh" title="永久链接至目标">¶</a></dt>
<dd><p>Mark for refresh but wait.  This function updates the data structure
representing the desired state of the window, but does not force an update of
the physical screen.  To accomplish that, call  <a class="reference internal" href="#curses.doupdate" title="curses.doupdate"><code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.overlay">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">overlay</code><span class="sig-paren">(</span><em class="sig-param">destwin</em><span class="optional">[</span>, <em class="sig-param">sminrow</em>, <em class="sig-param">smincol</em>, <em class="sig-param">dminrow</em>, <em class="sig-param">dmincol</em>, <em class="sig-param">dmaxrow</em>, <em class="sig-param">dmaxcol</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.overlay" title="永久链接至目标">¶</a></dt>
<dd><p>Overlay the window on top of <em>destwin</em>. The windows need not be the same size,
only the overlapping region is copied. This copy is non-destructive, which means
that the current background character does not overwrite the old contents of
<em>destwin</em>.</p>
<p>To get fine-grained control over the copied region, the second form of
<a class="reference internal" href="#curses.window.overlay" title="curses.window.overlay"><code class="xref py py-meth docutils literal notranslate"><span class="pre">overlay()</span></code></a> can be used. <em>sminrow</em> and <em>smincol</em> are the upper-left
coordinates of the source window, and the other variables mark a rectangle in
the destination window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.overwrite">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">overwrite</code><span class="sig-paren">(</span><em class="sig-param">destwin</em><span class="optional">[</span>, <em class="sig-param">sminrow</em>, <em class="sig-param">smincol</em>, <em class="sig-param">dminrow</em>, <em class="sig-param">dmincol</em>, <em class="sig-param">dmaxrow</em>, <em class="sig-param">dmaxcol</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.overwrite" title="永久链接至目标">¶</a></dt>
<dd><p>Overwrite the window on top of <em>destwin</em>. The windows need not be the same size,
in which case only the overlapping region is copied. This copy is destructive,
which means that the current background character overwrites the old contents of
<em>destwin</em>.</p>
<p>To get fine-grained control over the copied region, the second form of
<a class="reference internal" href="#curses.window.overwrite" title="curses.window.overwrite"><code class="xref py py-meth docutils literal notranslate"><span class="pre">overwrite()</span></code></a> can be used. <em>sminrow</em> and <em>smincol</em> are the upper-left
coordinates of the source window, the other variables mark a rectangle in the
destination window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.putwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">putwin</code><span class="sig-paren">(</span><em class="sig-param">file</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.putwin" title="永久链接至目标">¶</a></dt>
<dd><p>Write all data associated with the window into the provided file object.  This
information can be later retrieved using the <a class="reference internal" href="#curses.getwin" title="curses.getwin"><code class="xref py py-func docutils literal notranslate"><span class="pre">getwin()</span></code></a> function.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.redrawln">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">redrawln</code><span class="sig-paren">(</span><em class="sig-param">beg</em>, <em class="sig-param">num</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.redrawln" title="永久链接至目标">¶</a></dt>
<dd><p>Indicate that the <em>num</em> screen lines, starting at line <em>beg</em>, are corrupted and
should be completely redrawn on the next <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> call.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.redrawwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">redrawwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.redrawwin" title="永久链接至目标">¶</a></dt>
<dd><p>Touch the entire window, causing it to be completely redrawn on the next
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> call.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.refresh">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">refresh</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">pminrow</em>, <em class="sig-param">pmincol</em>, <em class="sig-param">sminrow</em>, <em class="sig-param">smincol</em>, <em class="sig-param">smaxrow</em>, <em class="sig-param">smaxcol</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.refresh" title="永久链接至目标">¶</a></dt>
<dd><p>Update the display immediately (sync actual screen with previous
drawing/deleting methods).</p>
<p>The 6 optional arguments can only be specified when the window is a pad created
with <a class="reference internal" href="#curses.newpad" title="curses.newpad"><code class="xref py py-func docutils literal notranslate"><span class="pre">newpad()</span></code></a>.  The additional parameters are needed to indicate what part
of the pad and screen are involved. <em>pminrow</em> and <em>pmincol</em> specify the upper
left-hand corner of the rectangle to be displayed in the pad.  <em>sminrow</em>,
<em>smincol</em>, <em>smaxrow</em>, and <em>smaxcol</em> specify the edges of the rectangle to be
displayed on the screen.  The lower right-hand corner of the rectangle to be
displayed in the pad is calculated from the screen coordinates, since the
rectangles must be the same size.  Both rectangles must be entirely contained
within their respective structures.  Negative values of <em>pminrow</em>, <em>pmincol</em>,
<em>sminrow</em>, or <em>smincol</em> are treated as if they were zero.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.resize">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">resize</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.resize" title="永久链接至目标">¶</a></dt>
<dd><p>Reallocate storage for a curses window to adjust its dimensions to the
specified values.  If either dimension is larger than the current values, the
window's data is filled with blanks that have the current background
rendition (as set by <a class="reference internal" href="#curses.window.bkgdset" title="curses.window.bkgdset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">bkgdset()</span></code></a>) merged into them.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.scroll">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">scroll</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">lines=1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.scroll" title="永久链接至目标">¶</a></dt>
<dd><p>Scroll the screen or scrolling region upward by <em>lines</em> lines.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.scrollok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">scrollok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.scrollok" title="永久链接至目标">¶</a></dt>
<dd><p>Control what happens when the cursor of a window is moved off the edge of the
window or scrolling region, either as a result of a newline action on the bottom
line, or typing the last character of the last line.  If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, the
cursor is left on the bottom line.  If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the window is scrolled up
one line.  Note that in order to get the physical scrolling effect on the
terminal, it is also necessary to call <a class="reference internal" href="#curses.window.idlok" title="curses.window.idlok"><code class="xref py py-meth docutils literal notranslate"><span class="pre">idlok()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.setscrreg">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">setscrreg</code><span class="sig-paren">(</span><em class="sig-param">top</em>, <em class="sig-param">bottom</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.setscrreg" title="永久链接至目标">¶</a></dt>
<dd><p>Set the scrolling region from line <em>top</em> to line <em>bottom</em>. All scrolling actions
will take place in this region.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.standend">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">standend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.standend" title="永久链接至目标">¶</a></dt>
<dd><p>Turn off the standout attribute.  On some terminals this has the side effect of
turning off all attributes.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.standout">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">standout</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.standout" title="永久链接至目标">¶</a></dt>
<dd><p>Turn on attribute <em>A_STANDOUT</em>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.subpad">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">subpad</code><span class="sig-paren">(</span><em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.subpad" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">subpad</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em>, <em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span></dt>
<dd><p>Return a sub-window, whose upper-left corner is at <code class="docutils literal notranslate"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and
whose width/height is <em>ncols</em>/<em>nlines</em>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.subwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">subwin</code><span class="sig-paren">(</span><em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.subwin" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">subwin</code><span class="sig-paren">(</span><em class="sig-param">nlines</em>, <em class="sig-param">ncols</em>, <em class="sig-param">begin_y</em>, <em class="sig-param">begin_x</em><span class="sig-paren">)</span></dt>
<dd><p>Return a sub-window, whose upper-left corner is at <code class="docutils literal notranslate"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and
whose width/height is <em>ncols</em>/<em>nlines</em>.</p>
<p>By default, the sub-window will extend from the specified position to the lower
right corner of the window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.syncdown">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">syncdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.syncdown" title="永久链接至目标">¶</a></dt>
<dd><p>Touch each location in the window that has been touched in any of its ancestor
windows.  This routine is called by <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>, so it should almost never
be necessary to call it manually.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.syncok">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">syncok</code><span class="sig-paren">(</span><em class="sig-param">flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.syncok" title="永久链接至目标">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, then <a class="reference internal" href="#curses.window.syncup" title="curses.window.syncup"><code class="xref py py-meth docutils literal notranslate"><span class="pre">syncup()</span></code></a> is called automatically
whenever there is a change in the window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.syncup">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">syncup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.syncup" title="永久链接至目标">¶</a></dt>
<dd><p>Touch all locations in ancestors of the window that have been changed in  the
window.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.timeout">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">timeout</code><span class="sig-paren">(</span><em class="sig-param">delay</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.timeout" title="永久链接至目标">¶</a></dt>
<dd><p>Set blocking or non-blocking read behavior for the window.  If <em>delay</em> is
negative, blocking read is used (which will wait indefinitely for input).  If
<em>delay</em> is zero, then non-blocking read is used, and <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> will
return <code class="docutils literal notranslate"><span class="pre">-1</span></code> if no input is waiting.  If <em>delay</em> is positive, then
<a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> will block for <em>delay</em> milliseconds, and return <code class="docutils literal notranslate"><span class="pre">-1</span></code> if there is
still no input at the end of that time.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.touchline">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">touchline</code><span class="sig-paren">(</span><em class="sig-param">start</em>, <em class="sig-param">count</em><span class="optional">[</span>, <em class="sig-param">changed</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.touchline" title="永久链接至目标">¶</a></dt>
<dd><p>Pretend <em>count</em> lines have been changed, starting with line <em>start</em>.  If
<em>changed</em> is supplied, it specifies whether the affected lines are marked as
having been changed (<em>changed</em><code class="docutils literal notranslate"><span class="pre">=True</span></code>) or unchanged (<em>changed</em><code class="docutils literal notranslate"><span class="pre">=False</span></code>).</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.touchwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">touchwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.touchwin" title="永久链接至目标">¶</a></dt>
<dd><p>Pretend the whole window has been changed, for purposes of drawing
optimizations.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.untouchwin">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">untouchwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.untouchwin" title="永久链接至目标">¶</a></dt>
<dd><p>Mark all lines in  the  window  as unchanged since the last call to
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="curses.window.vline">
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">vline</code><span class="sig-paren">(</span><em class="sig-param">ch</em>, <em class="sig-param">n</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.vline" title="永久链接至目标">¶</a></dt>
<dt>
<code class="sig-prename descclassname">window.</code><code class="sig-name descname">vline</code><span class="sig-paren">(</span><em class="sig-param">y</em>, <em class="sig-param">x</em>, <em class="sig-param">ch</em>, <em class="sig-param">n</em><span class="sig-paren">)</span></dt>
<dd><p>Display a vertical line starting at <code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code> with length <em>n</em> consisting of the
character <em>ch</em>.</p>
</dd></dl>

</div>
<div class="section" id="constants">
<h2>常量<a class="headerlink" href="#constants" title="永久链接至标题">¶</a></h2>
<p>The <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code></a> module defines the following data members:</p>
<dl class="data">
<dt id="curses.ERR">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">ERR</code><a class="headerlink" href="#curses.ERR" title="永久链接至目标">¶</a></dt>
<dd><p>Some curses routines  that  return  an integer, such as <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a>, return
<a class="reference internal" href="#curses.ERR" title="curses.ERR"><code class="xref py py-const docutils literal notranslate"><span class="pre">ERR</span></code></a> upon failure.</p>
</dd></dl>

<dl class="data">
<dt id="curses.OK">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">OK</code><a class="headerlink" href="#curses.OK" title="永久链接至目标">¶</a></dt>
<dd><p>Some curses routines  that  return  an integer, such as  <a class="reference internal" href="#curses.napms" title="curses.napms"><code class="xref py py-func docutils literal notranslate"><span class="pre">napms()</span></code></a>, return
<a class="reference internal" href="#curses.OK" title="curses.OK"><code class="xref py py-const docutils literal notranslate"><span class="pre">OK</span></code></a> upon success.</p>
</dd></dl>

<dl class="data">
<dt id="curses.version">
<code class="sig-prename descclassname">curses.</code><code class="sig-name descname">version</code><a class="headerlink" href="#curses.version" title="永久链接至目标">¶</a></dt>
<dd><p>A bytes object representing the current version of the module.  Also available as
<code class="xref py py-const docutils literal notranslate"><span class="pre">__version__</span></code>.</p>
</dd></dl>

<p>Some constants are available to specify character cell attributes.
The exact constants available are system dependent.</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 37%" />
<col style="width: 63%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>属性</p></th>
<th class="head"><p>含义</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_ALTCHARSET</span></code></p></td>
<td><p>备用字符集模式</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_BLINK</span></code></p></td>
<td><p>闪烁模式</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_BOLD</span></code></p></td>
<td><p>粗体模式</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_DIM</span></code></p></td>
<td><p>暗淡模式</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_INVIS</span></code></p></td>
<td><p>不可见或空白模式</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_ITALIC</span></code></p></td>
<td><p>斜体模式</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_NORMAL</span></code></p></td>
<td><p>正常属性</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_PROTECT</span></code></p></td>
<td><p>保护模式</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_REVERSE</span></code></p></td>
<td><p>反转背景色和前景色</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_STANDOUT</span></code></p></td>
<td><p>突出模式</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_UNDERLINE</span></code></p></td>
<td><p>下划线模式</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_HORIZONTAL</span></code></p></td>
<td><p>水平突出显示</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_LEFT</span></code></p></td>
<td><p>左高亮</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_LOW</span></code></p></td>
<td><p>底部高亮</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_RIGHT</span></code></p></td>
<td><p>右高亮</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_TOP</span></code></p></td>
<td><p>顶部高亮</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_VERTICAL</span></code></p></td>
<td><p>垂直突出显示</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_CHARTEXT</span></code></p></td>
<td><p>用于提取字符的位掩码</p></td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified added">3.7 新版功能: </span><code class="docutils literal notranslate"><span class="pre">A_ITALIC</span></code> was added.</p>
</div>
<p>有几个常量可用于提取某些方法返回的相应属性。</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 37%" />
<col style="width: 63%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>位掩码</p></th>
<th class="head"><p>含义</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_ATTRIBUTES</span></code></p></td>
<td><p>用于提取属性的位掩码</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">A_CHARTEXT</span></code></p></td>
<td><p>用于提取字符的位掩码</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">A_COLOR</span></code></p></td>
<td><p>用于提取颜色对字段信息的位掩码</p></td>
</tr>
</tbody>
</table>
<p>键由名称以 <code class="docutils literal notranslate"><span class="pre">KEY_</span></code> 开头的整数常量引用。确切的可用键取决于系统。</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 30%" />
<col style="width: 70%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>关键常数</p></th>
<th class="head"><p>（Windows 注册表的）键</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_MIN</span></code></p></td>
<td><p>最小键值</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_BREAK</span></code></p></td>
<td><p>中断键（不可靠）</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_DOWN</span></code></p></td>
<td><p>向下箭头</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_UP</span></code></p></td>
<td><p>向上箭头</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_LEFT</span></code></p></td>
<td><p>向左箭头</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_RIGHT</span></code></p></td>
<td><p>向右箭头</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_HOME</span></code></p></td>
<td><p>Home key (upward+left arrow)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_BACKSPACE</span></code></p></td>
<td><p>退格（不可靠）</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_F0</span></code></p></td>
<td><p>Function keys.  Up to 64 function keys are
supported.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_Fn</span></code></p></td>
<td><p>Value of function key <em>n</em></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_DL</span></code></p></td>
<td><p>删除行</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_IL</span></code></p></td>
<td><p>插入行</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_DC</span></code></p></td>
<td><p>Delete character</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_IC</span></code></p></td>
<td><p>Insert char or enter insert mode</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_EIC</span></code></p></td>
<td><p>Exit insert char mode</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_CLEAR</span></code></p></td>
<td><p>Clear screen</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_EOS</span></code></p></td>
<td><p>Clear to end of screen</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_EOL</span></code></p></td>
<td><p>Clear to end of line</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SF</span></code></p></td>
<td><p>Scroll 1 line forward</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SR</span></code></p></td>
<td><p>Scroll 1 line backward (reverse)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_NPAGE</span></code></p></td>
<td><p>下一页</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_PPAGE</span></code></p></td>
<td><p>上一页</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_STAB</span></code></p></td>
<td><p>Set tab</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_CTAB</span></code></p></td>
<td><p>Clear tab</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_CATAB</span></code></p></td>
<td><p>Clear all tabs</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_ENTER</span></code></p></td>
<td><p>Enter or send (unreliable)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SRESET</span></code></p></td>
<td><p>Soft (partial) reset (unreliable)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_RESET</span></code></p></td>
<td><p>Reset or hard reset (unreliable)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_PRINT</span></code></p></td>
<td><p>打印</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_LL</span></code></p></td>
<td><p>Home down or bottom (lower left)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_A1</span></code></p></td>
<td><p>键盘的左上角</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_A3</span></code></p></td>
<td><p>键盘的右上角</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_B2</span></code></p></td>
<td><p>键盘的中心</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_C1</span></code></p></td>
<td><p>键盘左下方</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_C3</span></code></p></td>
<td><p>键盘右下方</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_BTAB</span></code></p></td>
<td><p>Back tab</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_BEG</span></code></p></td>
<td><p>Beg (beginning)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_CANCEL</span></code></p></td>
<td><p>取消</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_CLOSE</span></code></p></td>
<td><p>关闭</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_COMMAND</span></code></p></td>
<td><p>Cmd (命令行)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_COPY</span></code></p></td>
<td><p>复制</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_CREATE</span></code></p></td>
<td><p>创建</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_END</span></code></p></td>
<td><p>End</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_EXIT</span></code></p></td>
<td><p>退出</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_FIND</span></code></p></td>
<td><p>查找</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_HELP</span></code></p></td>
<td><p>帮助</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_MARK</span></code></p></td>
<td><p>标记</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_MESSAGE</span></code></p></td>
<td><p>消息</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_MOVE</span></code></p></td>
<td><p>移动</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_NEXT</span></code></p></td>
<td><p>下一个</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_OPEN</span></code></p></td>
<td><p>打开</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_OPTIONS</span></code></p></td>
<td><p>选项</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_PREVIOUS</span></code></p></td>
<td><p>Prev (previous)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_REDO</span></code></p></td>
<td><p>重做</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_REFERENCE</span></code></p></td>
<td><p>Ref (reference)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_REFRESH</span></code></p></td>
<td><p>刷新</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_REPLACE</span></code></p></td>
<td><p>替换</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_RESTART</span></code></p></td>
<td><p>重启</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_RESUME</span></code></p></td>
<td><p>恢复</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SAVE</span></code></p></td>
<td><p>保存</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SBEG</span></code></p></td>
<td><p>Shifted Beg (beginning)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SCANCEL</span></code></p></td>
<td><p>Shifted Cancel</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SCOMMAND</span></code></p></td>
<td><p>Shifted Command</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SCOPY</span></code></p></td>
<td><p>Shifted Copy</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SCREATE</span></code></p></td>
<td><p>Shifted Create</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SDC</span></code></p></td>
<td><p>Shifted Delete char</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SDL</span></code></p></td>
<td><p>Shifted Delete line</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SELECT</span></code></p></td>
<td><p>Select</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SEND</span></code></p></td>
<td><p>Shifted End</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SEOL</span></code></p></td>
<td><p>Shifted Clear line</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SEXIT</span></code></p></td>
<td><p>Shifted Exit</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SFIND</span></code></p></td>
<td><p>Shifted Find</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SHELP</span></code></p></td>
<td><p>Shifted Help</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SHOME</span></code></p></td>
<td><p>Shifted Home</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SIC</span></code></p></td>
<td><p>Shifted Input</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SLEFT</span></code></p></td>
<td><p>Shifted Left arrow</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SMESSAGE</span></code></p></td>
<td><p>Shifted Message</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SMOVE</span></code></p></td>
<td><p>Shifted Move</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SNEXT</span></code></p></td>
<td><p>Shifted Next</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SOPTIONS</span></code></p></td>
<td><p>Shifted Options</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SPREVIOUS</span></code></p></td>
<td><p>Shifted Prev</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SPRINT</span></code></p></td>
<td><p>Shifted Print</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SREDO</span></code></p></td>
<td><p>Shifted Redo</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SREPLACE</span></code></p></td>
<td><p>Shifted Replace</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SRIGHT</span></code></p></td>
<td><p>Shifted Right arrow</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SRSUME</span></code></p></td>
<td><p>Shifted Resume</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SSAVE</span></code></p></td>
<td><p>Shifted Save</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SSUSPEND</span></code></p></td>
<td><p>Shifted Suspend</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SUNDO</span></code></p></td>
<td><p>Shifted Undo</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_SUSPEND</span></code></p></td>
<td><p>Suspend</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_UNDO</span></code></p></td>
<td><p>撤销操作</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_MOUSE</span></code></p></td>
<td><p>Mouse event has occurred</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_RESIZE</span></code></p></td>
<td><p>Terminal resize event</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_MAX</span></code></p></td>
<td><p>Maximum key value</p></td>
</tr>
</tbody>
</table>
<p>在VT100及其软件仿真（例如X终端仿真器）上，通常至少有四个功能键（ <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_F1</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_F2</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_F3</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_F4</span></code> ）可用，并且箭头键以明显的方式映射到 <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_UP</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_DOWN</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_LEFT</span></code> 和 <code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_RIGHT</span></code> 。如果您的机器有一个PC键盘，可以安全地使用箭头键和十二个功能键（旧的PC键盘可能只有十个功能键）;此外，以下键盘映射是标准的：</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 62%" />
<col style="width: 38%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>键帽</p></th>
<th class="head"><p>常数</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Insert</kbd></p></td>
<td><p>KEY_IC</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Delete</kbd></p></td>
<td><p>KEY_DC</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Home</kbd></p></td>
<td><p>KEY_HOME</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">End</kbd></p></td>
<td><p>KEY_END</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Page Up</kbd></p></td>
<td><p>KEY_PPAGE</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Page Down</kbd></p></td>
<td><p>KEY_NPAGE</p></td>
</tr>
</tbody>
</table>
<p>The following table lists characters from the alternate character set. These are
inherited from the VT100 terminal, and will generally be  available on software
emulations such as X terminals.  When there is no graphic available, curses
falls back on a crude printable ASCII approximation.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>只有在调用 <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a> 之后才能使用它们</p>
</div>
<table class="docutils align-default">
<colgroup>
<col style="width: 30%" />
<col style="width: 70%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>ACS代码</p></th>
<th class="head"><p>含义</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BBSS</span></code></p></td>
<td><p>右上角的别名</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BLOCK</span></code></p></td>
<td><p>实心方块</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BOARD</span></code></p></td>
<td><p>正方形</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BSBS</span></code></p></td>
<td><p>水平线的别名</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BSSB</span></code></p></td>
<td><p>左上角的别名</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BSSS</span></code></p></td>
<td><p>顶部 T 型的别名</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BTEE</span></code></p></td>
<td><p>底部 T 型</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_BULLET</span></code></p></td>
<td><p>正方形</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_CKBOARD</span></code></p></td>
<td><p>棋盘（点刻）</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_DARROW</span></code></p></td>
<td><p>向下箭头</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_DEGREE</span></code></p></td>
<td><p>等级符</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_DIAMOND</span></code></p></td>
<td><p>菱形</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_GEQUAL</span></code></p></td>
<td><p>大于或等于</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_HLINE</span></code></p></td>
<td><p>水平线</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_LANTERN</span></code></p></td>
<td><p>灯形符号</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_LARROW</span></code></p></td>
<td><p>向左箭头</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_LEQUAL</span></code></p></td>
<td><p>小于或等于</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_LLCORNER</span></code></p></td>
<td><p>左下角</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_LRCORNER</span></code></p></td>
<td><p>右下角</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_LTEE</span></code></p></td>
<td><p>左侧 T 型</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_NEQUAL</span></code></p></td>
<td><p>不等号</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_PI</span></code></p></td>
<td><p>字母π</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_PLMINUS</span></code></p></td>
<td><p>正负号</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_PLUS</span></code></p></td>
<td><p>加号</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_RARROW</span></code></p></td>
<td><p>向右箭头</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_RTEE</span></code></p></td>
<td><p>右侧 T 型</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_S1</span></code></p></td>
<td><p>扫描线 1</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_S3</span></code></p></td>
<td><p>扫描线3</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_S7</span></code></p></td>
<td><p>扫描线7</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_S9</span></code></p></td>
<td><p>扫描线 9</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SBBS</span></code></p></td>
<td><p>右下角的别名</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SBSB</span></code></p></td>
<td><p>垂直线的别名</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SBSS</span></code></p></td>
<td><p>右侧 T 型的别名</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SSBB</span></code></p></td>
<td><p>左下角的别名</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SSBS</span></code></p></td>
<td><p>底部 T 型的别名</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SSSB</span></code></p></td>
<td><p>左侧 T 型的别名</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_SSSS</span></code></p></td>
<td><p>alternate name for crossover or big plus</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_STERLING</span></code></p></td>
<td><p>英镑</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_TTEE</span></code></p></td>
<td><p>顶部 T 型</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_UARROW</span></code></p></td>
<td><p>向上箭头</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_ULCORNER</span></code></p></td>
<td><p>左上角</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_URCORNER</span></code></p></td>
<td><p>右上角</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">ACS_VLINE</span></code></p></td>
<td><p>垂线</p></td>
</tr>
</tbody>
</table>
<p>下表列出了预定义的颜色：</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 40%" />
<col style="width: 60%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>常数</p></th>
<th class="head"><p>颜色</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_BLACK</span></code></p></td>
<td><p>黑色</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_BLUE</span></code></p></td>
<td><p>蓝色</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_CYAN</span></code></p></td>
<td><p>青色（浅绿蓝色）</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_GREEN</span></code></p></td>
<td><p>绿色</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_MAGENTA</span></code></p></td>
<td><p>洋红色（紫红色）</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_RED</span></code></p></td>
<td><p>红色</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_WHITE</span></code></p></td>
<td><p>白色</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">COLOR_YELLOW</span></code></p></td>
<td><p>黄色</p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="module-curses.textpad">
<span id="curses-textpad-text-input-widget-for-curses-programs"></span><h1><a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.textpad</span></code></a> --- Text input widget for curses programs<a class="headerlink" href="#module-curses.textpad" title="永久链接至标题">¶</a></h1>
<p>The <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.textpad</span></code></a> module provides a <a class="reference internal" href="#curses.textpad.Textbox" title="curses.textpad.Textbox"><code class="xref py py-class docutils literal notranslate"><span class="pre">Textbox</span></code></a> class that handles
elementary text editing in a curses window, supporting a set of keybindings
resembling those of Emacs (thus, also of Netscape Navigator, BBedit 6.x,
FrameMaker, and many other programs).  The module also provides a
rectangle-drawing function useful for framing text boxes or for other purposes.</p>
<p>The module <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.textpad</span></code></a> defines the following function:</p>
<dl class="function">
<dt id="curses.textpad.rectangle">
<code class="sig-prename descclassname">curses.textpad.</code><code class="sig-name descname">rectangle</code><span class="sig-paren">(</span><em class="sig-param">win</em>, <em class="sig-param">uly</em>, <em class="sig-param">ulx</em>, <em class="sig-param">lry</em>, <em class="sig-param">lrx</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.rectangle" title="永久链接至目标">¶</a></dt>
<dd><p>Draw a rectangle.  The first argument must be a window object; the remaining
arguments are coordinates relative to that window.  The second and third
arguments are the y and x coordinates of the upper left hand corner of the
rectangle to be drawn; the fourth and fifth arguments are the y and x
coordinates of the lower right hand corner. The rectangle will be drawn using
VT100/IBM PC forms characters on terminals that make this possible (including
xterm and most other software terminal emulators).  Otherwise it will be drawn
with ASCII  dashes, vertical bars, and plus signs.</p>
</dd></dl>

<div class="section" id="textbox-objects">
<span id="curses-textpad-objects"></span><h2>文本框对象<a class="headerlink" href="#textbox-objects" title="永久链接至标题">¶</a></h2>
<p>You can instantiate a <a class="reference internal" href="#curses.textpad.Textbox" title="curses.textpad.Textbox"><code class="xref py py-class docutils literal notranslate"><span class="pre">Textbox</span></code></a> object as follows:</p>
<dl class="class">
<dt id="curses.textpad.Textbox">
<em class="property">class </em><code class="sig-prename descclassname">curses.textpad.</code><code class="sig-name descname">Textbox</code><span class="sig-paren">(</span><em class="sig-param">win</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox" title="永久链接至目标">¶</a></dt>
<dd><p>Return a textbox widget object.  The <em>win</em> argument should be a curses
<a class="reference internal" href="#curses-window-objects"><span class="std std-ref">window</span></a> object in which the textbox is to
be contained. The edit cursor of the textbox is initially located at the
upper left hand corner of the containing window, with coordinates <code class="docutils literal notranslate"><span class="pre">(0,</span> <span class="pre">0)</span></code>.
The instance's <a class="reference internal" href="#curses.textpad.Textbox.stripspaces" title="curses.textpad.Textbox.stripspaces"><code class="xref py py-attr docutils literal notranslate"><span class="pre">stripspaces</span></code></a> flag is initially on.</p>
<p><a class="reference internal" href="#curses.textpad.Textbox" title="curses.textpad.Textbox"><code class="xref py py-class docutils literal notranslate"><span class="pre">Textbox</span></code></a> objects have the following methods:</p>
<dl class="method">
<dt id="curses.textpad.Textbox.edit">
<code class="sig-name descname">edit</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">validator</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox.edit" title="永久链接至目标">¶</a></dt>
<dd><p>This is the entry point you will normally use.  It accepts editing
keystrokes until one of the termination keystrokes is entered.  If
<em>validator</em> is supplied, it must be a function.  It will be called for
each keystroke entered with the keystroke as a parameter; command dispatch
is done on the result. This method returns the window contents as a
string; whether blanks in the window are included is affected by the
<a class="reference internal" href="#curses.textpad.Textbox.stripspaces" title="curses.textpad.Textbox.stripspaces"><code class="xref py py-attr docutils literal notranslate"><span class="pre">stripspaces</span></code></a> attribute.</p>
</dd></dl>

<dl class="method">
<dt id="curses.textpad.Textbox.do_command">
<code class="sig-name descname">do_command</code><span class="sig-paren">(</span><em class="sig-param">ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox.do_command" title="永久链接至目标">¶</a></dt>
<dd><p>处理单个按键命令。以下是支持的特殊按键：</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 30%" />
<col style="width: 70%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>按键</p></th>
<th class="head"><p>动作</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-A</kbd></p></td>
<td><p>转到窗口的左边缘。</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Control-B</kbd></p></td>
<td><p>光标向左，如果可能，包含前一行。</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-D</kbd></p></td>
<td><p>删除光标下的字符。</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Control-E</kbd></p></td>
<td><p>Go to right edge (stripspaces off) or end
of line (stripspaces on).</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-F</kbd></p></td>
<td><p>向右移动光标，适当时换行到下一行。</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Control-G</kbd></p></td>
<td><p>终止，返回窗口内容。</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-H</kbd></p></td>
<td><p>向后删除字符。</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Control-J</kbd></p></td>
<td><p>如果窗口是1行则终止，否则插入换行符。</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-K</kbd></p></td>
<td><p>如果行为空，则删除它，否则清除到行尾。</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Control-L</kbd></p></td>
<td><p>刷新屏幕。</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-N</kbd></p></td>
<td><p>光标向下;向下移动一行。</p></td>
</tr>
<tr class="row-odd"><td><p><kbd class="kbd docutils literal notranslate">Control-O</kbd></p></td>
<td><p>在光标位置插入一个空行。</p></td>
</tr>
<tr class="row-even"><td><p><kbd class="kbd docutils literal notranslate">Control-P</kbd></p></td>
<td><p>光标向上;向上移动一行。</p></td>
</tr>
</tbody>
</table>
<p>如果光标位于无法移动的边缘，则移动操作不执行任何操作。在可能的情况下，支持以下同义词：</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 57%" />
<col style="width: 43%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>常数</p></th>
<th class="head"><p>按键</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_LEFT</span></code></p></td>
<td><p><kbd class="kbd docutils literal notranslate">Control-B</kbd></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_RIGHT</span></code></p></td>
<td><p><kbd class="kbd docutils literal notranslate">Control-F</kbd></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_UP</span></code></p></td>
<td><p><kbd class="kbd docutils literal notranslate">Control-P</kbd></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_DOWN</span></code></p></td>
<td><p><kbd class="kbd docutils literal notranslate">Control-N</kbd></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_BACKSPACE</span></code></p></td>
<td><p><kbd class="kbd docutils literal notranslate">Control-h</kbd></p></td>
</tr>
</tbody>
</table>
<p>All other keystrokes are treated as a command to insert the given
character and move right (with line wrapping).</p>
</dd></dl>

<dl class="method">
<dt id="curses.textpad.Textbox.gather">
<code class="sig-name descname">gather</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox.gather" title="永久链接至目标">¶</a></dt>
<dd><p>Return the window contents as a string; whether blanks in the
window are included is affected by the <a class="reference internal" href="#curses.textpad.Textbox.stripspaces" title="curses.textpad.Textbox.stripspaces"><code class="xref py py-attr docutils literal notranslate"><span class="pre">stripspaces</span></code></a> member.</p>
</dd></dl>

<dl class="attribute">
<dt id="curses.textpad.Textbox.stripspaces">
<code class="sig-name descname">stripspaces</code><a class="headerlink" href="#curses.textpad.Textbox.stripspaces" title="永久链接至目标">¶</a></dt>
<dd><p>This attribute is a flag which controls the interpretation of blanks in
the window.  When it is on, trailing blanks on each line are ignored; any
cursor motion that would land the cursor on a trailing blank goes to the
end of that line instead, and trailing blanks are stripped when the window
contents are gathered.</p>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">目录</a></h3>
  <ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> --- 终端字符单元显示的处理</a><ul>
<li><a class="reference internal" href="#functions">函数</a></li>
<li><a class="reference internal" href="#window-objects">Window Objects</a></li>
<li><a class="reference internal" href="#constants">常量</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-curses.textpad"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.textpad</span></code> --- Text input widget for curses programs</a><ul>
<li><a class="reference internal" href="#textbox-objects">文本框对象</a></li>
</ul>
</li>
</ul>

  <h4>上一个主题</h4>
  <p class="topless"><a href="getpass.html"
                        title="上一章"><code class="xref py py-mod docutils literal notranslate"><span class="pre">getpass</span></code> --- 便携式密码输入工具</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="curses.ascii.html"
                        title="下一章"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.ascii</span></code> --- Utilities for ASCII characters</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">提交 Bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/3.7/Doc/library/curses.rst"
            rel="nofollow">显示源代码
        </a>
      </li>
    </ul>
  </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="总目录"
             >索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="curses.ascii.html" title="curses.ascii --- Utilities for ASCII characters"
             >下一页</a> |</li>
        <li class="right" >
          <a href="getpass.html" title="getpass --- 便携式密码输入工具"
             >上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">3.7.8 Documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >Python 标准库</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="allos.html" >通用操作系统服务</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="快速搜索" type="text" name="q" />
          <input type="submit" value="转向" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">版权所有</a> 2001-2020, Python Software Foundation.
    <br />
    Python 软件基金会是一个非盈利组织。
    <a href="https://www.python.org/psf/donations/">请捐助。</a>
    <br />
    最后更新于 6月 29, 2020.
    <a href="../bugs.html">发现了问题</a>？
    <br />
    使用<a href="http://sphinx.pocoo.org/">Sphinx</a>2.3.1 创建。
    </div>

  </body>
</html>